package o;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.Fragment.InstantiationException;

public class jy {
    private static final dy<String, Class<?>> ˏ = new dy();

    @NonNull
    private static Class<?> ˎ(@NonNull ClassLoader classLoader, @NonNull String str) throws ClassNotFoundException {
        Class<?> cls = (Class) ˏ.get(str);
        if (cls != null) {
            return cls;
        }
        cls = Class.forName(str, false, classLoader);
        ˏ.put(str, cls);
        return cls;
    }

    static boolean ˏ(@NonNull ClassLoader classLoader, @NonNull String str) {
        try {
            return Fragment.class.isAssignableFrom(ˎ(classLoader, str));
        } catch (ClassNotFoundException e) {
            return false;
        }
    }

    @NonNull
    public static Class<? extends Fragment> ˋ(@NonNull ClassLoader classLoader, @NonNull String str) {
        try {
            return ˎ(classLoader, str);
        } catch (Exception e) {
            throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class name exists", e);
        } catch (Exception e2) {
            throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class is a valid subclass of Fragment", e2);
        }
    }

    @NonNull
    public Fragment ॱ(@NonNull ClassLoader classLoader, @NonNull String str) {
        try {
            return (Fragment) ˋ(classLoader, str).getConstructor(new Class[0]).newInstance(new Object[0]);
        } catch (Exception e) {
            throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class name exists, is public, and has an empty constructor that is public", e);
        } catch (Exception e2) {
            throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class name exists, is public, and has an empty constructor that is public", e2);
        } catch (Exception e22) {
            throw new InstantiationException("Unable to instantiate fragment " + str + ": could not find Fragment constructor", e22);
        } catch (Exception e222) {
            throw new InstantiationException("Unable to instantiate fragment " + str + ": calling Fragment constructor caused an exception", e222);
        }
    }
}
